/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.isd.global.modelo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import com.isd.pool.modelo.Pool;
import com.isd.promocion.modelo.Promocion;

/**
 *
 * @author ctrosch
 */
@Entity
@Table(name = "USR_TVBNNR")
public class ItemBanner implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ItemBannerPK itemBannerPK;
    @Basic(optional = false)

    @Column(name = "USR_TVBNNR_NORDEN", insertable=false, updatable=false)
    private int orden;

    @ManyToOne
    @JoinColumn(name = "USR_TVBNNR_TVCONF_ID", referencedColumnName = "USR_TVCONF_ID", nullable = false, insertable=false, updatable=false)
    private Parametro parametro;

    @Column(name = "USR_TVBNNR_DESCRP", nullable = false, length = 60)
    private String descripcion;
    @Basic(optional = false)
    @Lob
    @Column(name = "USR_TVBNNR_PATHIM", nullable = false, length = 2147483647)
    private String pathImagen;
    @Lob
    @Column(name = "USR_TVBNNR_LINK", length = 2147483647)
    private String link;
    @Column(name = "USR_TVBNNR_SUGERE", length = 60)
    private String sugerencia;

    @Column(name = "USR_TVBNNR_TIPBNR", length = 2)
    private String tipoBanner;

    @ManyToOne
    @JoinColumn(name = "USR_TVBNNR_NROPRO", referencedColumnName = "USR_TVPROH_NROPRO", nullable = false, insertable=false, updatable=false)
    private Promocion promocion;

    @ManyToOne
    @JoinColumn(name = "USR_TVBNNR_NROPOL", referencedColumnName = "USR_POOL_NRPOOL", nullable = false, insertable=false, updatable=false)
    private Pool pool;

    @Column(name = "USR_TVBNNR_ACTIVO")
    private String activo;
    
    @Column(name = "USR_TV_DEBAJA")
    private Character debaja;


    public ItemBanner() {
    }

    public ItemBanner(ItemBannerPK itemBannerPK) {
        this.itemBannerPK = itemBannerPK;
    }

    public ItemBanner(ItemBannerPK itemBannerPK, String usrTvbnnrDescrp, String usrTvbnnrPathim) {
        this.itemBannerPK = itemBannerPK;
        this.descripcion = usrTvbnnrDescrp;
        this.pathImagen = usrTvbnnrPathim;
    }

    public int getOrden() {
        return orden;
    }

    public void setOrden(int orden) {
        this.orden = orden;
    }

    public Parametro getParametro() {
        return parametro;
    }

    public void setParametro(Parametro parametro) {
        this.parametro = parametro;
    }   

    public ItemBanner(short usrTvbnnrTvconfId, short usrTvbnnrNorden) {
        this.itemBannerPK = new ItemBannerPK(usrTvbnnrTvconfId, usrTvbnnrNorden);
    }

    public ItemBannerPK getItemBannerPK() {
        return itemBannerPK;
    }

    public void setItemBannerPK(ItemBannerPK itemBannerPK) {
        this.itemBannerPK = itemBannerPK;
    }

    public String getActivo() {
        return activo;
    }

    public void setActivo(String activo) {
        this.activo = activo;
    }

    public Character getDebaja() {
        return debaja;
    }

    public void setDebaja(Character debaja) {
        this.debaja = debaja;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }

    public String getPathImagen() {
        return pathImagen;
    }

    public void setPathImagen(String pathImagen) {
        this.pathImagen = pathImagen;
    }

    public String getSugerencia() {
        return sugerencia;
    }

    public void setSugerencia(String sugerencia) {
        this.sugerencia = sugerencia;
    }

    public Pool getPool() {
        return pool;
    }

    public void setPool(Pool pool) {
        this.pool = pool;
    }

    public Promocion getPromocion() {
        return promocion;
    }

    public void setPromocion(Promocion promocion) {
        this.promocion = promocion;
    }

    public String getTipoBanner() {
        return tipoBanner;
    }

    public void setTipoBanner(String tipoBanner) {
        this.tipoBanner = tipoBanner;
    }
    
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (itemBannerPK != null ? itemBannerPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ItemBanner)) {
            return false;
        }
        ItemBanner other = (ItemBanner) object;
        if ((this.itemBannerPK == null && other.itemBannerPK != null) || (this.itemBannerPK != null && !this.itemBannerPK.equals(other.itemBannerPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "tv.global.modelo.ItemBanner[itemBannerPK=" + itemBannerPK + "]";
    }

}
